package controls;

import java.util.Observable;
import java.util.Observer;

import models.UsuarioLink;
import models.VeiculoTree;

import views.PanCliHome;
import views.WinCliente;
import views.WinLogin;

public class ControllerCliente implements Observer{
	protected static VeiculoTree veiculo_tree = new VeiculoTree();
	protected UsuarioLink link_cliente = new UsuarioLink();
	WinCliente winCliente    = new WinCliente();
	
	public void main(WinLogin windowLogin, UsuarioLink key_cliente){
		link_cliente = key_cliente;
		init();
		winCliente.criaJanela(windowLogin);
		winCliente.setLocation(windowLogin.getLocation());
		winCliente.showWindow();
		winCliente.addObserver(this);
		
		PanCliHome pc_home = new PanCliHome();
		pc_home.criaPanel();
		
		winCliente.setContent(pc_home.getPanel());	
	}
	
	@Override
	public void update(Observable arg0, Object arg1){
		String action = new String ((String) arg1);
		
		if(action.compareTo("cliVerDados") == 0){
			ControllerCliVerDados con_cli_ver_dados = new ControllerCliVerDados();
			con_cli_ver_dados.main(link_cliente);
			winCliente.setContent(con_cli_ver_dados.getPanel());
		}
		
		if(action.compareTo("cliEditarDados") == 0){
			
		}
		
		if(action.compareTo("cliListarServicos") == 0){
			
		}
		
		if(action.compareTo("cliFindServico") == 0){
			
		}
		
		if(action.compareTo("cliVerServico") == 0){
			
		}
		
		if(action.compareTo("cliAgendarServico") == 0){
			
		}
		
		if(action.compareTo("cliAprovarPeca") == 0){
			
		}
	}
	
	public void init(){
		//veiculo_tree.insert(10, 123, 1, 1, 1, "JDK1234");
		//veiculo_tree.insert(10, 123, 1, 1, 1, "SDK1234");
		//veiculo_tree.insert(10, 123, 1, 1, 1, "JRE1234");
		
		//Object [][] temp = new Object[4][6];
		//temp = veiculo_tree.findList(VeiculoTree.getRoot(), 123);
		
		//System.out.println(temp[0][5]);
		//System.out.println(temp[1][5]);
		//System.out.println(temp[2][5]);
	}
}